const http = require('http');

// 创建服务器并定义路由
const server1 = http.createServer((req, res) => {
  const { url, method } = req;
  if (url === '/' && method === 'GET') {
    res.writeHead(200, { 'Content-Type': 'text/html' });
    res.end('HomePage');
  } else if (url === '/about' && method === 'GET') {
    res.writeHead(200, { 'Content-Type': 'text/html' });
    res.end('AboutPage');
  } else {
    res.writeHead(404, { 'Content-Type': 'text/html' });
    res.end('404 Not Found');
  }
});

server1.listen(3000, () => {
  console.log('Server is running on port 3000');
});
